﻿Imports System.Drawing.Icon

Public Class CONFIGCOS

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        If (NumericUpDown1.Value > 0 And ComboBox1.SelectedItem = "SideA" Or ComboBox1.SelectedItem = "SideB" Or ComboBox1.SelectedItem = "SideC" Or ComboBox1.SelectedItem = "AngleX") Then
            Me.Hide()
        Else
            Me.Close()
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        ColorDialog1.ShowDialog()

        If (ColorDialog1.Color = Color.White) Then
            Button1.BackColor = Color.White
            Main.AnswerBox.ForeColor = Color.White
        ElseIf (ColorDialog1.Color = Color.Red) Then
            Button1.BackColor = Color.Red
            Main.AnswerBox.ForeColor = Color.Red
        ElseIf (ColorDialog1.Color = Color.Yellow) Then
            Button1.BackColor = Color.Yellow
            Main.AnswerBox.ForeColor = Color.Yellow
        ElseIf (ColorDialog1.Color = Color.Blue) Then
            Button1.BackColor = Color.Blue
            Main.AnswerBox.ForeColor = Color.Blue
        Else
            Button1.BackColor = Color.White
            Main.Label11.ForeColor = Color.White
        End If
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

        If (ComboBox1.SelectedItem = "SideA") Then
            AvailA.Value = 1
            AvailS.Value = 2
        ElseIf (ComboBox1.SelectedItem = "SideB") Then
            AvailA.Value = 1
            AvailS.Value = 2
        ElseIf (ComboBox1.SelectedItem = "SideC") Then
            AvailA.Value = 1
            AvailS.Value = 2
        ElseIf (ComboBox1.SelectedItem = "AngleX") Then
            AvailA.Value = 0
            AvailS.Value = 3
        End If
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        If (ComboBox1.SelectedItem = Nothing) Then
            ErrorProvider1.SetError(ComboBox1, "Select subject of formular here.")
        ElseIf (Not ComboBox1.SelectedItem = Main.ComboBox1.SelectedItem) Then
            ErrorProvider1.SetError(ComboBox1, "Subject formulars mismatch >>> Please check if your selection" & vbCrLf & "in this menu is the same what you selected in the main Trigsoft window Solving menu.")

        ElseIf (ComboBox1.SelectedItem = "SideX") Then

            ErrorProvider1.Clear()

            For I As Integer = 0 To 1000

                StatusStrip1.Visible = True
                ToolStripProgressBar1.Increment(I)


                If (ToolStripProgressBar1.Value = 1000) Then
                    StatusStrip1.Visible = False
                End If

            Next I

            Main.SideYBox.Enabled = True
            Main.AreaBox.Enabled = True
            Main.Clear.Enabled = True
            Main.NumericUpDown1.Enabled = True
            Main.SideYBox.Focus()
            Main.SideXBox.Enabled = False


            ToolStripProgressBar1.Value = 0
            Me.Hide()

        ElseIf (ComboBox1.SelectedItem = "SideY") Then

            ErrorProvider1.Clear()
            StatusStrip1.Visible = False

            For I As Integer = 0 To 1000
                StatusStrip1.Visible = True
                ToolStripProgressBar1.Increment(I)


                If (ToolStripProgressBar1.Value = 1000) Then
                    ToolStripProgressBar1.Visible = False
                End If

            Next I

            Main.SideXBox.Enabled = True
            Main.NumericUpDown1.Enabled = True
            Main.AreaBox.Enabled = True
            Main.Clear.Enabled = True
            Main.SideXBox.Focus()
            Main.SideYBox.Enabled = False


            ToolStripProgressBar1.Value = 0
            Me.Hide()


        ElseIf (ComboBox1.SelectedItem = "AngleX") Then

            ErrorProvider1.Clear()
            StatusStrip1.Visible = False

            For I As Integer = 0 To 1000

                If (I > 1) Then
                    StatusStrip1.Visible = True
                End If

                ToolStripProgressBar1.Increment(I)


                If (ToolStripProgressBar1.Value = 1000) Then
                    ToolStripProgressBar1.Visible = False
                End If

            Next I
            Main.Clear.Enabled = True
            Main.SideYBox.Enabled = True
            Main.SideXBox.Enabled = True
            Main.AreaBox.Enabled = True
            Main.SideXBox.Focus()
            Main.NumericUpDown1.Enabled = False

            ToolStripProgressBar1.Value = 0
            Me.Hide()

        ElseIf (ComboBox1.SelectedItem = "SideZ") Then

            ErrorProvider1.Clear()
            StatusStrip1.Visible = False

            For I As Integer = 0 To 1000
                StatusStrip1.Visible = True
                ToolStripProgressBar1.Increment(I)


                If (ToolStripProgressBar1.Value = 1000) Then
                    StatusStrip1.Visible = False
                End If

            Next I
            Main.Clear.Enabled = True
            Main.SideYBox.Enabled = True
            Main.SideXBox.Enabled = True
            Main.AreaBox.Enabled = False
            Main.SideXBox.Focus()
            Main.NumericUpDown1.Enabled = True

            ToolStripProgressBar1.Value = 0
            Me.Hide()

        End If
    End Sub
End Class